package toOffer;

import java.util.Arrays;

/**
 * @author YuanAo
 * @date 2025/4/14 9:41
 * @description
 */
public class LCR004 {

    public static void main(String[] args) {
        int[] nums = {0, 1, 0, 1, 0, 1, 100};
        int i = singleNumber(nums);
        System.out.println(i);
    }

    public static int singleNumber(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0; i < nums.length; i += 3) {
            if (i != nums.length - 1){
                if (nums[i] != nums[i + 1] && nums[i] != nums[i + 2]){
                    return nums[i];
                }
            }else {
                return nums[i];
            }
        }
        return 0;
    }


}
